import request from "@/utils/request";
//用户登录
export function loginApi(loginForm){
    return request({
        method:'post',
        url:'/user/login',
        data:{
            username:loginForm.username,
            password:loginForm.password
        }
    })
}
//用户验证码登录
export function loginByCodeApi(loginForm){
    console.log(loginForm.code)
    console.log(loginForm.email)
    return request({
        method:'post',
        url:'/user/loginByCode',
        params:{
            "email":loginForm.email,
            "code":loginForm.code
        }
    })
}
//用户注册
export function registerApi(registerForm){
    return request({
        method:'post',
        url:'/user/register',
        params:{
            "code":registerForm.code
        },
        data:{
            username:registerForm.username,
            password:registerForm.password,
            email:registerForm.email
        }
    })
}
//用户修改个人信息
export function userUpdateApi(userInfo){
    return request({
        method:'post',
        url:'/user/update',
        data: userInfo
    })
}
//用户登出
export function userLogoutApi(){
    return request({
        method:'get',
        url:'/user/logout',
    })
}
//获取用户信息
export function getUserInfoApi(){
    return request({
        method:'get',
        url:'/user/info'
    })
}
//获取验证码
export function getCodeApi(email){
    return request({
        method:'get',
        url:'/user/sendCode',
        params:{
            "email":email
        }
    })
}
